<?php
require_once('../../config.php');
Doctrine::loadModels('../../models');

if( $_REQUEST["message_id"]) 
{
	$message_id = strip_tags($_REQUEST["message_id"]);
    $subject_id = strip_tags($_REQUEST["subject_id"]);
    $title = strip_tags($_REQUEST["title"]);
    $rating_id = strip_tags($_REQUEST["rating_id"]);
    $message = strip_tags($_REQUEST["message"]);
    $isPublic = strip_tags($_REQUEST["message_is_public"]);
	$modified = date("Y-m-d H:m:s");
	  
	$db_query = sprintf("UPDATE agent_message 
							SET subject_id='".$subject_id."',
								rating_id='".$rating_id."',
								title='".$title."',
								message='".$message."',
								message_is_public='".$isPublic."',
								modified='".$modified."'
							WHERE message_id='".$message_id."'");
 
 	file_put_contents  ( "update_message.txt", $db_query);   
 
 	$result = mysql_query($db_query);
    	if (!$result) {
        		die('invalid query');    // . mysql_error());
    		}
}
	
?>